<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		*{
			margin: 0px;
			padding: 0px;
		}
		li{
			list-style: none;
		}
		a{
			text-decoration: none;
			color: #fff;
			line-height: 40px;
			font-size: 18px;
			display: inline-block;
			padding: 0 15px;
			font-weight: 600;
			float: left;
		}
		.nav{
			width: 100%;
			height: 40px;
			background: #01204F url() 0 0 no-repeat;
			margin-top: 100px;
		}
		.mid{
			width: 1000px;
			height: 40px;
			margin:  0 auto;
			position: relative;
		}
		.home{
			background: #CC0000 url() 0 0 no-repeat;
		}
		.red{
			width: 50px;
			height: 40px;
			background: #CC0000 url() 0 0 no-repeat;
			position: absolute;
			top: 0px;
			left: 0px;
			z-index: 888;
		}
		.nav_list{
			position: absolute;
			top: 0px;
			left: 0px;
			z-index: 999;
		}
		
	</style>
	<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
	<script>
		$(function () {
			$('.link').hover(function() {

				w = $(this).width()+30;

				console.log(w);

				left = $(this).position().left;

				$('.red').stop().animate({left:left+"px",width:w+"px"}, 200)

			}, function() {
				$('.red').stop().animate({left:"0px",width:"0px"}, 500)
			});
			
		})
	</script>
</head>
<body>
	<div class="nav">
		<div class="mid">
			<div class="nav_list">
				<a href="" class="link home">首页</a>
				<a href="" class="link">百家号</a>
				<a href="" class="link">国内</a>
				<a href="" class="link">国际</a>
				<a href="" class="link">互联网</a>
				<a href="" class="link">财经</a>
				<a href="" class="link">个性推荐</a>
			</div>
			<div class="red"></div>
		</div>
		
	</div>
</body>
</html>